package com.tencent.ied.bk.unittest;

import com.tencent.ied.bk.CSearchAbstract;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import static org.junit.Assert.assertEquals;

public class CTestSearchAbstract {

    @Before
    public void setUp() throws Exception {
    }

    @After
    public void tearDown() throws Exception {
    }

    @Test
    public void testFindFlushPattern() {
        CSearchAbstract objSA = new CSearchAbstract();
        objSA.addAbstract("These are good books .You can choose one book from them.", 9);
        objSA.addAbstract("You can search books from Google.", 8);
        objSA.addAbstract("Search and preview millions of books from libraries and publishers worldwide using Google Book Search.", 8);
        objSA.addAbstract("Go to Google Books Home. Advanced Book Search, About Google ... All books.", 6);
        objSA.addAbstract("Bookshelf provides free access to books and documents in life science and healthcare.", 7);

        String strRst = objSA.searchAbstract("BOOK");
        String rstExpt = "These are good books .You can choose one book from them.# Search and preview millions " +
                "of books from libraries and publishers worldwide using Google Book Search.# You can search books from Google.# Bookshelf provides" +
                " free access to books and documents in life science and healthcare.# Go to Google Books Home. Advanced Book Search, About " +
                "Google ... All books.";
        assertEquals(strRst, rstExpt);
        strRst = objSA.searchAbstract("google");
        rstExpt = "You can search books from Google.# Search and preview millions of books from libraries and publishers worldwide using "
                + "Google Book Search.# Go to Google Books Home. Advanced Book Search, About Google ... All books.";

        assertEquals(strRst, rstExpt);
    }
}
